<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="libman.css">
<TITLE>
Repair Constraints
</TITLE>
</HEAD>
<BODY >
<A HREF="libman066.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="libman064.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="libman068.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc151">10.3</A>&nbsp;&nbsp;Repair Constraints</H2>

Once a constraint has been declared to be a repair constraint it
is monitored for violation. Whether a repair 
<A NAME="@default376"></A>
constraint is considered to be violated depends on the states of 
its variables. A temporary assignment of the variables is used 
for checking constraints. This assignment is called the
<EM>tentative assignment</EM> and is described above.
A constraint which is violated in this way is called a
<A NAME="@default377"></A>
<EM>conflict constraint</EM>.<BR>
<BR>
<A NAME="@default378"></A>
<A NAME="@default379"></A>
Normal constraints are turned into repair constraints by giving them
one of the following annotations:<BR>
<BR>

<H4 CLASS="subsubsection">Constraint r_conflict ConflictSet</H4>
<A NAME="@default380"></A>
This is the simplest form of annotation.
<A HREF="../bips/lib/repair/r_conflict-2.html"><B>r_conflict/2</B></A><A NAME="@default381"></A>
makes a constraint known
to the repair library, i.e. it will initiate monitoring of
<B>Constraint</B> for conflicts.
When the constraint goes into conflict, it will show up in the
conflict set denoted by <B>ConflictSet</B>, from where it can be
retrieved using <A HREF="../bips/lib/repair/conflict_constraints-2.html"><B>conflict_constraints/2</B></A><A NAME="@default382"></A>.
<B>Constraint</B> can be any goal that works logically, it should be useable
as a ground check, and work on any instantiation pattern. Typically,
it will be a constraint from some solver library.
<B>ConflictSet</B> can be a user-defined name (an atom) or it can be
a variable in which case the system returns a conflict set handle that can
later be passed to <A HREF="../bips/lib/repair/conflict_constraints-2.html"><B>conflict_constraints/2</B></A><A NAME="@default383"></A>. Example constraint with
annotation:
<BLOCKQUOTE CLASS="quote"><PRE CLASS="verbatim">
fd:(Capacity &gt;= sum(Weights))  r_conflict  cap_cstr
</PRE></BLOCKQUOTE>
Note that using different conflict sets for different groups of constraints
will often make the search algorithm easier and more efficient.
A second allowed form of the
<A HREF="../bips/lib/repair/r_conflict-2.html"><B>r_conflict/2</B></A><A NAME="@default384"></A>
annotation is
<B>Constraint r_conflict ConflictSet-ConflictData</B>.
If this is used, <B>ConflictData</B> will appear in the conflict
set instead of the <B>Constraint</B> itself.
This feature can be used to pass additional information to the
search algorithm.<BR>
<BR>

<H4 CLASS="subsubsection">Constraint r_conflict_prop ConflictSet</H4>
<A NAME="@default385"></A>
In addition to what
<A HREF="../bips/lib/repair/r_conflict-2.html"><B>r_conflict/2</B></A><A NAME="@default386"></A>
does, the
<A HREF="../bips/lib/repair/r_conflict_prop-2.html"><B>r_conflict_prop/2</B></A><A NAME="@default387"></A>
annotation causes the
<B>Constraint</B> to be activated as a goal as soon as it goes into
conflict for the first time. If <B>Constraint</B> is a finite-domain
constraint for example, this means that domain-based propagation on
<B>Constraint</B> will start at that point in time.<BR>
<BR>
Note that if you want constraint propagation from the very beginning,
you should simply write the constraint twice, once without and once
with annotation.<BR>
<BR>
<HR>
<A HREF="libman066.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="libman064.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="libman068.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
